package com.GUI;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class firstwindow {

  public static void main(String[] args) {
    JFrame jf = new JFrame("First Window");
    jf.setBounds(520, 300, 400, 300);
    jf.setBackground(Color.green);
    jf.setResizable(false);
    jf.setLayout(new FlowLayout(FlowLayout.LEFT));
    JTextArea area = new JTextArea(10, 20);
    area.setLineWrap(true); // 设置自动换行；
    JButton jb = new JButton("偷袭！");
    jb.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent e) {
        area.append("耗子尾汁");
      }
    });
    jf.add(area);
    jf.add(jb);
    jf.setVisible(true);
    jf.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
  }
}
